import inputCommon from '../../../../mixin/inputCommon'

export default {
  name: 'textRender',
  props: ['config', 'scope', 'editor'],
  inject: ['rootForm'],
  mixins: [inputCommon],
  data() {
    return {
      valEmpty: true
    }
  },
  methods: {
    getContent() {
      return this.getParsedEx('contentExpression')()
    }
  },
  created() {
    this.$watch(this.getParsedEx('contentExpression'), (v) => {
      if (!v || v.length === 0) {
        this.valEmpty = false
      } else {
        this.valEmpty = true
        this.$nextTick(() => {
          this.$el.classList && this.$el.classList.add(this.pluginUniqueId)
        })
      }
    }, { immediate: true })
  }
}
